-
Notifications
You must be signed in to change notification settings - Fork 1
feat: support RN app migration #561
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements migration support for transitioning users from the React Native Bitkit app to the native Android version. The migration preserves critical wallet data including balances, channels, activities, settings, widgets, and tags/notes while maintaining a recovery path if issues occur.
Key changes:
- Adds comprehensive RN data migration logic handling MMKV storage, keychain data, and LDK channel state
- Implements migration loading UI with timeout protection and error handling
- Coordinates migration flow across wallet initialization, node startup, and data synchronization phases
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| gradle/libs.versions.toml | Updates ldk-node-android dependency to v0.7.0-rc.2 |
| app/build.gradle.kts | Bumps version code from 17 to 160 |
| MigrationService.kt | Core migration service handling RN data extraction, decryption, and native app data transformation |
| MmkvParser.kt | Binary parser for React Native MMKV storage format |
| MigrationLoadingScreen.kt | Loading screen UI displayed during migration process |
| WalletViewModel.kt | Orchestrates migration check and execution during wallet initialization |
| AppViewModel.kt | Handles migration completion, sync coordination, and timeout management |
| MainActivity.kt | Integrates migration loading screen into app navigation flow |
| LightningService.kt | Adds channel migration support to LDK node setup |
| LightningRepo.kt | Extends node start/setup to accept channel migration data and adds restart capability |
| CoreService.kt | Adds method to mark all unseen activities as seen during migration |
| ActivityRepo.kt | Exposes payment sync and bulk activity marking methods for migration |
781737a to
8c82b68
Compare
b30f0d8 to
db68175
Compare
|
Failed restoring the channels on local migration, I'll try again, just in case Native data RN data |
Second attempt, still failed. also noticed that the PIN was not imported |
|
Tested: On RN
On Android
From the warnings, the PR needs a cleanup. After that I'll do a last review |
|
In CI the Not sure, but maybe #565 will fix it? lightning_-_Lightning_lightning_1_-_Can_receive_and_send_LN_payments-2026-01-01T13-14-46-568Z.mp4 |
Probably. It has some improvements in this logic |
|
Can I review it already? |
|
Yes should be ready |
|
@ben-kaufman the pull from master should fix the E2E errors |
|
@ben-kaufman can I test it again? |
|
Yes 👍 |
jvsena42
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Created RN wallet with passphrase
- Opened channel and did LN operations
- Deleted the app
- Installed the native
- Recover the app
- LN data was not recovered ❌
I send the logs in DM
|
Recover of LN channels should be fixed now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Approved with 2 nits, which I would like to defer to post-merge.
📋 Aside from these code-related remarks the other thing we discussed in DMs about migrating over the list of hidden todos from RN into the removedSuggestions list is the only comment I could add.
👏🏻 Everything else looks good to me, I like that most of the code is contained, given one day we will have to remove all of this, when we have enough indications that no more users need to migrate.
🧪 Tested by building the mainnet apk with the store release key and installing the APK over the PROD RN app which had a rather new wallet with most settings altered and 2 LN channels.
🟢 Everything migrated flawless and I was able to continue making and receiving payments to the 2 channels that persisted their open state.
Great work! 🥇
| val selectedPairs = priceJson["selectedPairs"]?.jsonArray?.mapNotNull { pairElement -> | ||
| val pairStr = pairElement.jsonPrimitive.content.replace("_", "/") | ||
| when (pairStr) { | ||
| "BTC/USD" -> to.bitkit.data.dto.price.TradingPair.BTC_USD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
|
||
| return runCatching { | ||
| val keysManager = KeysManager.of(bip32Seed, seconds, nanoSeconds) | ||
| val method = keysManager.javaClass.getMethod("get_node_secret_key") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: investigating if there's a non-reflective alternative to handle this, meanwhile we can merge this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
found a way in fa59e07
Will push it in a separate small PR which will include the cleanup for the other comment

This PR adds support for migrating an existing React Native Bitkit into the Bitkit native app.
The migration passes:
Balances
Channels
Activities
Settings
Widgets
Tags and notes
Closed Channels
It also adds support for restoring a wallet created in RN app which was later deleted. Ie. create wallet in RN, use it, delete the app, install native, recover using mnemonic.
What's still needed:
New design for the loading screen and success toast of migration